package edu.zut.main.thread;

public class ThreadYield {
    public static void main(String[] args) {
        Yield yield = new Yield();

        new Thread(yield,"线程A").start();
        new Thread(yield,"线程B").start();
        new Thread(yield,"线程C").start();

    }

}

class Yield implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + " begin...");
        //线程的礼让   它是让当前获取cpu资源的线程重新回到就绪状态
        Thread.yield();
        System.out.println(Thread.currentThread().getName() + " over...");
    }
}

